How to use autocomplete in jquery
1733
28-Sep-2016
I want to use jquery autocomplete search box in my project . Please help me by giving a demo .
Anonymous User
28-Sep-2016This is a jQuery method used in modern websites to provide the user with a list of suggestions for the beginning of the word he has typed in a text box. The user can then select an item from the list, which will be displayed in the input field. This feature prevents the user from having to enter an entire word.
jQueryUI provides an autocomplete widget—a control that acts a lot like a <select> dropdown, but filters the choices to present only those that match what the user is typing into a control. jQueryUI provides the autocomplete() method to create a list of suggestions below the input field and adds new CSS classes to the elements concerned to give them the appropriate styleSyntax
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> <script src="https://code.jquery.com/jquery-1.12.4.js"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> <div class="ui-widget"> <label for="tags">Search: </label> <input id="tags"> </div> <script> $(function () { var SearchData = [ "AngularJs", "KnockoutJs", "Asp", "BASIC", "C", "C++", "Clojure", "COBOL", "ColdFusion", "C#", "VB", "SQL", "Haskell", "Java", "JavaScript", "Lisp", "Perl", "PHP", "Python", "Ruby", "Scala", "Scheme" ]; $("#tags").autocomplete({ source: SearchData }); }); </script>